package com.itheima.jdk11;

import java.io.IOException;

/**
 * @program: itheima-jdk8
 * @description:
 * @author: zhanghz001
 * @create: 2021-01-10 10:59
 **/
public class JdkDemo {
    public static void main(String[] args) throws IOException, InterruptedException {
        // //var 关键字使用
        // var a = "  string  ";
        //
        // //增加了几个string的操作方法
        // System.out.println(a.isBlank());
        // System.out.println(a.strip());
        // System.out.println(a.stripLeading());
        // System.out.println(a.stripTrailing());
        // System.out.println(a.repeat(3));
        //
        // //新增创建集合方式,创建的集合长度不变,不能修改
        // List<Integer> list = List.of(1, 2, 3, 4, 5, 6);
        // // list.add(3);
        // List<Integer> arrayList = new ArrayList<>();
        // arrayList.add(2);
        // List<Integer> list2 = List.copyOf(arrayList);
        // // list2.add(1);
        //
        // //files增强
        // String s = Files.readString(Paths.get("./itheima-jdk8.iml"
        //         // "D:\\tmp\\itheima-jdk8\\out\\production\\itheima-jdk8\\com\\itheima\\date"
        // ), Charset.defaultCharset());
        // // System.out.println(s);
        //
        // //HTTP Client Api\
        // HttpRequest request = HttpRequest.newBuilder()
        //         .uri(URI.create("http://www.itcast.cn"))
        //         .build();
        //
        // //
        // HttpClient client = HttpClient.newHttpClient();
        // //同步
        // HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        // System.out.println(response.body());
        // //异步
        // client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
        //         .thenApply(HttpResponse::body)
        //         .thenAccept(System.out::println);
    }
}
